// pages/bargainRecords/bargainRecords.js
const app = getApp();
let utils = require('../../utils/util.js');

Page({
  data: {
    scrollHeight: 0, //"滚动视图的高度"
    recordItems: [],
  },

  onLoad: function(options) {
    app.globalData.recordItems = [{
        recordId:'1',
        helpName: '就是砍',
        time: '2018-08-09 14:37',
        helpPrice: 3.4,
        curPrice: 31.00
      },
      {
        recordId: '2',
        helpName: '于然',
        time: '2018-08-09 14:37',
        helpPrice: 3.4,
        curPrice: 31.00
      }
    ];
    this.setData({recordItems: app.globalData.recordItems});
  },
  onPullDownRefresh: function() {
    //下拉刷新
    let clearId = setTimeout(() => {
      clearTimeout(clearId);
      // app.globalData.recordItems.push({
      //   recordId: (app.globalData.recordItems.length+1).toString(),
      //   helpName: '就是砍',
      //   time: '2018-08-09 14:37',
      //   helpPrice: 3.4,
      //   curPrice: 31.00
      // });
      if (this.data.recordItems.length < app.globalData.recordItems.length){
        this.setData({ recordItems: app.globalData.recordItems });
      }
      wx.stopPullDownRefresh(); //停止下拉刷新
    }, 800);
  }
})